package router

import (
	"github.com/gin-gonic/gin"
	"go-demo/common/global"
	"go-demo/middleware"
	"go-demo/mvc/controller"
	"go-demo/mvc/service"
)

func QuestionRouter(router *gin.Engine) {
	questionService := service.NewQuestionService(global.App.Mysql)
	questionController := controller.NewQuestionController(questionService)

	router.Use(middleware.JWTMiddleware()) // 添加 jwt 中间件
	routerGroup := router.Group("question")
	{
		routerGroup.GET("/getVo/:id", questionController.GetQuestion)
		routerGroup.POST("/page", questionController.Page)
	}
}
